/**
 * File Comment: Ita a GUI
 */
package edu.gatech.oad.project.presentation;
//$codepro.audit.disable
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * This class is a panel that allows the user
 * to interact with the GUI by providing a
 * home screen.
 * 
 * @author Group 17
 * @version 1
 */
public class SysAdminHome extends JPanel {
  
  /**
   * Field driver: holds the Driver connected to the GUI
   */
  private Driver driver;
  
  /**
   * Field lblSysAdminHome: label
   */
  public JLabel lblSysAdminHome;
  
  /**
   * Field btnVieweditUsers: view/edit accounts button
   */
  public JButton btnVieweditUsers;
  
  /**
   * Field btnViewEditPatients: view/edit patients button
   */
  public JButton btnViewEditPatients;
  
  /**
   * Field btnAppByDoc: appointments by doctor button
   */
  public JButton btnAppByDoc;
  
  /**
   * Field btnAppByDate: appointments by date button
   */
  public JButton btnAppByDate;
  
  /**
   * Field btnViewMonthlyIncome: view monthly income statement button
   */
  public JButton btnViewMonthlyIncome;
  
  /**
   * Field btnLogOut: log out button
   */
  public JButton btnLogOut;

 /**
  * Constructor.
  * 
  * @param driver the Driver connected to the GUI
  */
 public SysAdminHome(Driver driver) {
   this.driver = driver;
  GridBagLayout gridBagLayout = new GridBagLayout();
  gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
  gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  setLayout(gridBagLayout);
  
  lblSysAdminHome = new JLabel("System Admin Home");
  lblSysAdminHome.setFont(new Font("Lucida Grande", Font.PLAIN, 30));
  GridBagConstraints gbc_lblSysAdminHome = new GridBagConstraints();
  gbc_lblSysAdminHome.insets = new Insets(0, 0, 5, 5);
  gbc_lblSysAdminHome.gridx = 2;
  gbc_lblSysAdminHome.gridy = 1;
  add(lblSysAdminHome, gbc_lblSysAdminHome);
  
  btnVieweditUsers = new JButton("View/Edit Accounts");
  btnVieweditUsers.addActionListener(new ButtonListener1(this));
  GridBagConstraints gbc_btnVieweditUsers = new GridBagConstraints();
  gbc_btnVieweditUsers.insets = new Insets(0, 0, 5, 5);
  gbc_btnVieweditUsers.gridx = 2;
  gbc_btnVieweditUsers.gridy = 3;
  add(btnVieweditUsers, gbc_btnVieweditUsers);
  
  btnViewEditPatients = new JButton("View/Edit Patients");
  btnViewEditPatients.addActionListener(new ButtonListener2(this));
  GridBagConstraints gbc_btnViewEditPatients = new GridBagConstraints();
  gbc_btnViewEditPatients.insets = new Insets(0, 0, 5, 5);
  gbc_btnViewEditPatients.gridx = 2;
  gbc_btnViewEditPatients.gridy = 4;
  add(btnViewEditPatients, gbc_btnViewEditPatients);
  
  btnAppByDoc = new JButton("Appointments by Doctor");
  btnAppByDoc.addActionListener(new ButtonListener3(this));
  GridBagConstraints gbc_btnCancelAnAppointment = new GridBagConstraints();
  gbc_btnCancelAnAppointment.insets = new Insets(0, 0, 5, 5);
  gbc_btnCancelAnAppointment.gridx = 2;
  gbc_btnCancelAnAppointment.gridy = 5;
  add(btnAppByDoc, gbc_btnCancelAnAppointment);
  
  btnAppByDate = new JButton("Appointments for the Day");
  btnAppByDate.addActionListener(new ButtonListener4(this));
  GridBagConstraints gbc_btnViewMedicalHistory = new GridBagConstraints();
  gbc_btnViewMedicalHistory.insets = new Insets(0, 0, 5, 5);
  gbc_btnViewMedicalHistory.gridx = 2;
  gbc_btnViewMedicalHistory.gridy = 6;
  add(btnAppByDate, gbc_btnViewMedicalHistory);
  
  btnViewMonthlyIncome = new JButton("View Monthly Income Statement");
  btnViewMonthlyIncome.addActionListener(new ButtonListener5(this));
  GridBagConstraints gbc_btnViewMonthlyIncome = new GridBagConstraints();
  gbc_btnViewMonthlyIncome.insets = new Insets(0, 0, 5, 5);
  gbc_btnViewMonthlyIncome.gridx = 2;
  gbc_btnViewMonthlyIncome.gridy = 7;
  add(btnViewMonthlyIncome, gbc_btnViewMonthlyIncome);
  
  btnLogOut = new JButton("Log Out");
  btnLogOut.addActionListener(new ButtonListener6(this));
  GridBagConstraints gbc_btnLogOut = new GridBagConstraints();
  gbc_btnLogOut.insets = new Insets(0, 0, 5, 5);
  gbc_btnLogOut.gridx = 2;
  gbc_btnLogOut.gridy = 8;
  add(btnLogOut, gbc_btnLogOut);
 } // end constructor method

 /**
  * Get the Driver.
  * 
  * @return the Driver connected to the GUI
  */
 public Driver getDriver()
 {
   return this.driver;
 } // end getDriver method

 /**
  * This private inner class implements ActionListener for btnVieweditUsers.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener1 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener1(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new UserList(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener1 class
 
 /**
  * This private inner class implements ActionListener for btnViewEditPatients.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener2 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener2(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new SysAdminPatientList(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener2 class
 
 /**
  * This private inner class implements ActionListener for btnAppByDoc.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener3 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /*
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener3(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new SysAdminAppByDoctor(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener3 class
 
 /**
  * This private inner class implements ActionListener for btnAppByDate.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener4 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener4(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new SysAdminAppByDate(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener4 class
 
 /**
  * This private inner class implements ActionListener for btnViewMonthlyIncome.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener5 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener5(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new SysAdminIncomeStatement(this.driver, this.driver.getSession().getUser()));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener5 class
 
 /**
  * This private inner class implements ActionListener for btnLogOut.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener6 implements ActionListener
 {
   /**
    * Field home: the SysAdminHome being used
    */
   private SysAdminHome home;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param home the SysAdminHome being used
    */
   private ButtonListener6(SysAdminHome home)
   {
     this.home = home;
     this.driver = home.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new LogIn(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener6 class
} // end SysAdminHome class